package org.evil.dog;

import lombok.extern.log4j.Log4j2;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;

import java.net.InetAddress;

@SpringBootApplication
@EnableEurekaClient
@ComponentScan(basePackages = {"org.evil"})
@EnableFeignClients(basePackages = {"org.evil"})
//@EnableScheduling
@Log4j2
public class DogUserApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(DogUserApplication.class, args);
        log.info("evil-dog-user 启动完成！");
        log.info("**************************************");
        try {
            String port = context.getEnvironment().getProperty("server.port");
            String path = context.getEnvironment().getProperty("server.servlet.context-path");
            InetAddress[] addresses = InetAddress.getAllByName(InetAddress.getLocalHost().getHostAddress());
            for (InetAddress ip : addresses) {
                String host = ip.getHostAddress();
                log.info(">>>>>>>> evil-dog-user 信息:" + host + ":" + port + path);
            }
        }catch (Exception e){
            log.error(">>>>>>>> evil-dog-user 启动异常！：",e);
        }
        log.info("**************************************");
        System.out.println("============evil-dog-user启动完成=============");
    }
}
